﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/JAFagus.Master"  AutoEventWireup="true" CodeBehind="TinTucSuKien.aspx.cs" Inherits="Indeco.G24.Website.News.Admin.TinTucSuKien" %>
<%@ Register Src="~/UserControls/MenuNewsAdmin.ascx" TagName="Menu" TagPrefix="G24" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolderMain">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<script type="text/javascript">
function Insert(idTinTuc,idTinTucDanhMuc,id)
{      
    var webRequest = new Sys.Net.WebRequest();
    webRequest.set_url("TinTucSuKien.aspx?action=Insert&idTinTuc="+idTinTuc+"&idTinTucDanhMuc="+idTinTucDanhMuc+"&id="+id);
    webRequest.get_headers()["Pragma"] = "No-Cache";
    webRequest.add_completed(completedInsert);
    webRequest.invoke();
   
}
function completedInsert(result, eventArgs) {
    if(result.get_responseAvailable()) {
        var data = result.get_responseData();
        if (data.length > 0)
        { 
          var res=eval("("+data+")");         
           if(res.sucess=="true")
           {
                var bt=document.getElementById("a"+res.id);
                var bto=document.getElementById("d"+res.id);
                if(bt&&bto)
                {
                    bt.disabled=true;
                    bto.disabled=false;
                }  
           }
           else if(res.sucess=="false")
           {
              alert("Ban tin da ton tai");              
           }  
        }
    }    
}
function Remove(idTinTuc,idTinTucDanhMuc,id)
{    
    var webRequest = new Sys.Net.WebRequest();
    webRequest.set_url("TinTucSuKien.aspx?action=Remove&idTinTuc="+idTinTuc+"&idTinTucDanhMuc="+idTinTucDanhMuc+"&id="+id);
    webRequest.get_headers()["Pragma"] = "No-Cache";
    webRequest.add_completed(completedRemove);
    webRequest.invoke();  
}
function completedRemove(result, eventArgs) {
    if(result.get_responseAvailable()) {
        var data = result.get_responseData();
        if (data.length > 0)
        { 
            var res=eval("("+data+")");               
            if(res.sucess=="true")
           {
                var bt=document.getElementById("d"+res.id);
                var bto=document.getElementById("a"+res.id);
                if(bt&&bto)
                {
                    bt.disabled=true;
                    bto.disabled=false;
                }  
           }
           else if(res.sucess==="false")
           {
              alert("Ban tin ko ton tai");              
           }  
        }
    }    
}
</script>
<asp:Panel ID="content" Width="100%" runat="server" Height="100%" HorizontalAlign="Center">
<div style="width:939px;padding:2,2,2,2;float:left;">
<div style="float:left;width:190px;margin-left:7px;" >  
 <G24:Menu ID="menu1" runat="server" />   
</div>
<div style="float:left;width:735px;padding-left:2px;">
<table width="725px" border="0" cellpadding="0" cellspacing="0">
        <tr>
        <td class="tdBCTopLeft"></td>
        <td class="tdBCTopCenter"></td>
        <td class="tdBCTopRight"></td>
        </tr>
        <tr>
        <td class="tdBCMiddleLeft"><div class="tdBCMiddleLeft" style="visibility:hidden"></div></td>
        <td class="tdBCMiddleCenter">
	        <div class="divBCMiddleCenterHeader" >
                <div class="divBCMiddleCenterHeaderTitle" >                 
                    <span class="span-blockTitle"><asp:HyperLink ID="HyperLink2" ForeColor="#FFFFFF" CssClass="span-blockTitleTxt" runat="server">Quản lý tin tức sự kiện</asp:HyperLink></span>
                </div>
            </div>
            <div class="divBCMiddleCenterContent" style="">
              <dxwgv:ASPxGridView ID="ASPxGridView3"  ClientInstanceName="grid" runat="server"
           AutoGenerateColumns="False" Width="100%" 
           CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"   CssPostfix="BlackGlass"            
            >
          <Columns>            
             <dxwgv:GridViewDataTextColumn FieldName="Ten" 
             VisibleIndex="0" Name="Danh Muc Cha" GroupIndex="0" Caption="Danh Muc Cha" SortIndex="0" SortOrder="Ascending">
              <Settings  GroupInterval="DisplayText"/> 
              </dxwgv:GridViewDataTextColumn>     
              <dxwgv:GridViewDataTextColumn FieldName="TieuDe"
               VisibleIndex="1" Name="Tieu De" Caption="Tieu De Tin Tuc" >               
             </dxwgv:GridViewDataTextColumn>    
               <dxwgv:GridViewDataTextColumn FieldName="IDTinTuc"
              Visible="false">               
             </dxwgv:GridViewDataTextColumn> 
               <dxwgv:GridViewDataTextColumn FieldName="IDTinTucDanhMuc"
              Visible="false" >               
             </dxwgv:GridViewDataTextColumn>           
             <dxwgv:GridViewDataButtonEditColumn VisibleIndex="2">
             <DataItemTemplate>                                
                 <input class="button" style="cursor:hand;" id='<%#"a"+Eval("ID")%>'  type="button" <%#(Convert.ToBoolean(Eval("isCheck"))==true)?"disabled":""%> value="Add" onclick="Insert('<%# Eval("IDTinTuc").ToString()%>', '<%# Eval("IDtinTucDanhMuc").ToString()%>','<%# Eval("ID").ToString()%>')" />
                 <input class="button" style="cursor:hand;" id='<%#"d"+Eval("ID")%>'  type="button" <%#(Convert.ToBoolean(Eval("isCheck"))==true)?"":"disabled"%> value="Del" onclick="Remove('<%# Eval("IDTinTuc").ToString()%>', '<%# Eval("IDtinTucDanhMuc").ToString()%>','<%# Eval("ID").ToString()%>')" />
             </DataItemTemplate>
             </dxwgv:GridViewDataButtonEditColumn>               
          </Columns>
      <Settings ShowGroupPanel="True" ShowFooter="True"/>
    <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass">
    <AlternatingRow Enabled="True"/>
        <Header ImageSpacing="5px" SortingImageSpacing="5px">
        </Header>
     </Styles>
       <SettingsEditing PopupEditFormModal="True" Mode="EditForm"  />  
         <Images ImageFolder="~/App_Themes/BlackGlass/{0}/">            
         </Images>
    </dxwgv:ASPxGridView>                
            </div>
        </td>
        <td class="tdBCMiddleRight"><div class="tdBCMiddleRight" style="visibility:hidden"></div></td>
        </tr>
        <tr>
        <td class="tdBCBottomLeft"></td>
        <td class="tdBCBottomCenter"></td>
        <td class="tdBCBottomRight"></td>
        </tr>
    </table>   
  </div>
  </div>       
</asp:Panel>
    &nbsp;</asp:Content>

